summaryrefslogtreecommitdiff
path: root/app/[lng]/engineering/(engineering)/items-tech
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-06-30 08:28:13 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-06-30 08:28:13 +0000
commit5b6313f16f508882a0ea67716b7dbaa1c6967f04 (patch)
tree3d1d8dafea2f31274ace3fbda08333e889e06d1c /app/[lng]/engineering/(engineering)/items-tech
parent3f0fad18483a5c800c79c5e33946d9bb384c10e2 (diff)
(대표님) 20250630 16시 - 유저 도메인별 라우터 분리와 보안성검토 대응
Diffstat (limited to 'app/[lng]/engineering/(engineering)/items-tech')
-rw-r--r--app/[lng]/engineering/(engineering)/items-tech/layout.tsx38
-rw-r--r--app/[lng]/engineering/(engineering)/items-tech/page.tsx67
2 files changed, 105 insertions, 0 deletions
diff --git a/app/[lng]/engineering/(engineering)/items-tech/layout.tsx b/app/[lng]/engineering/(engineering)/items-tech/layout.tsx
new file mode 100644
index 00000000..d375059b
--- /dev/null
+++ b/app/[lng]/engineering/(engineering)/items-tech/layout.tsx
@@ -0,0 +1,38 @@
+import * as React from "react"
+import { ItemTechContainer } from "@/components/items-tech/item-tech-container"
+import { Shell } from "@/components/shell"
+import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
+
+// Layout 컴포넌트는 서버 컴포넌트입니다
+export default function ItemsShipLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ // 아이템 타입 정의
+ const itemTypes = [
+ { id: "ship", name: "조선 아이템" },
+ { id: "top", name: "해양 TOP" },
+ { id: "hull", name: "해양 HULL" },
+ ]
+
+ return (
+ <Shell className="gap-4">
+ <React.Suspense
+ fallback={
+ <DataTableSkeleton
+ columnCount={6}
+ searchableColumnCount={1}
+ filterableColumnCount={2}
+ cellWidths={["10rem", "40rem", "12rem", "12rem", "8rem", "8rem"]}
+ shrinkZero
+ />
+ }
+ >
+ <ItemTechContainer itemTypes={itemTypes}>
+ {children}
+ </ItemTechContainer>
+ </React.Suspense>
+ </Shell>
+ )
+}
diff --git a/app/[lng]/engineering/(engineering)/items-tech/page.tsx b/app/[lng]/engineering/(engineering)/items-tech/page.tsx
new file mode 100644
index 00000000..55ac9c63
--- /dev/null
+++ b/app/[lng]/engineering/(engineering)/items-tech/page.tsx
@@ -0,0 +1,67 @@
+import * as React from "react"
+import { type SearchParams } from "@/types/table"
+
+import { getValidFilters } from "@/lib/data-table"
+import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
+import { shipbuildingSearchParamsCache, offshoreTopSearchParamsCache, offshoreHullSearchParamsCache } from "@/lib/items-tech/validations"
+import { getShipbuildingItems, getOffshoreTopItems, getOffshoreHullItems } from "@/lib/items-tech/service"
+import { OffshoreTopTable } from "@/lib/items-tech/table/top/offshore-top-table"
+import { OffshoreHullTable } from "@/lib/items-tech/table/hull/offshore-hull-table"
+
+// 대소문자 문제 해결 - 실제 파일명에 맞게 import
+import { ItemsShipTable } from "@/lib/items-tech/table/ship/Items-ship-table"
+
+interface IndexPageProps {
+ searchParams: Promise<SearchParams>
+}
+
+export default async function IndexPage({ searchParams }: IndexPageProps) {
+ const params = await searchParams
+ const shipbuildingSearch = shipbuildingSearchParamsCache.parse(params)
+ const offshoreTopSearch = offshoreTopSearchParamsCache.parse(params)
+ const offshoreHullSearch = offshoreHullSearchParamsCache.parse(params)
+ const validShipbuildingFilters = getValidFilters(shipbuildingSearch.filters || [])
+ const validOffshoreTopFilters = getValidFilters(offshoreTopSearch.filters || [])
+ const validOffshoreHullFilters = getValidFilters(offshoreHullSearch.filters || [])
+
+
+ // URL에서 아이템 타입 가져오기
+ const itemType = params.type || "ship"
+
+ return (
+ <div>
+ {itemType === "ship" && (
+ <ItemsShipTable
+ promises={Promise.all([
+ getShipbuildingItems({
+ ...shipbuildingSearch,
+ filters: validShipbuildingFilters,
+ }),
+ ]).then(([result]) => result)}
+ />
+ )}
+
+ {itemType === "top" && (
+ <OffshoreTopTable
+ promises={Promise.all([
+ getOffshoreTopItems({
+ ...offshoreTopSearch,
+ filters: validOffshoreTopFilters,
+ }),
+ ]).then(([result]) => result)}
+ />
+ )}
+
+ {itemType === "hull" && (
+ <OffshoreHullTable
+ promises={Promise.all([
+ getOffshoreHullItems({
+ ...offshoreHullSearch,
+ filters: validOffshoreHullFilters,
+ }),
+ ]).then(([result]) => result)}
+ />
+ )}
+ </div>
+ )
+}